<script type="text/javascript" charset="utf-8" src="__STATIC__/admin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/admin/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="__STATIC__/admin/ueditor/lang/zh-cn/zh-cn.js"></script>

<div class="header">
    <h1 class="page-title">商品新增</h1>
</div>

<!-- add form -->
<form action="{:url('admin/goods/save')}" method="post" id="tab" enctype="multipart/form-data">
    {:token()}
    <input type="hidden" name="_method" value="PUT">
    <ul class="nav nav-tabs">
        <li role="presentation" class="active"><a href="#basic" data-toggle="tab">基本信息</a></li>
        <li role="presentation"><a href="#desc" data-toggle="tab">商品描述</a></li>
        <li role="presentation"><a href="#attr" data-toggle="tab">商品属性</a></li>
        <li role="presentation"><a href="#pics" data-toggle="tab">商品相册</a></li>
    </ul>
    <div class="tab-content">
        <div class="tab-pane fade in active" id="basic">
            <div class="well">
                <label>商品名称：</label>
                <input type="text" name="goods_name" value="" class="input-xlarge">
                <label>商品价格：</label>
                <input type="text" name="goods_price" value="" class="input-xlarge">
                <label>商品数量：</label>
                <input type="text" name="goods_number" value="" class="input-xlarge">
                <label>商品logo：</label>
                <input type="file" name="goods_logo" value="" class="input-xlarge">
            </div>
        </div>
        <div class="tab-pane fade in" id="desc">
            <div class="well">
                <label>商品简介：</label>
                <textarea name="goods_desc" rows="3" class="input-xlarge" id="editor" style="width: 80%;height: 300px;"></textarea>
            </div>
        </div>
        <div class="tab-pane fade in" id="attr">
            <div class="well">
                <label>商品类型：</label>
                <select name="" class="input-xlarge">
                    <option value="2">电脑</option>
                    <option value="1">手机</option>
                </select>
                <div>
                    <label>商品品牌：</label>
                    <input type="text" name="" value="" class="input-xlarge">
                    <label>商品型号：</label>
                    <input type="text" name="" value="" class="input-xlarge">
                    <label>商品重量：</label>
                    <input type="text" name="" value="" class="input-xlarge">
                </div>
            </div>
        </div>
        <div class="tab-pane fade in" id="pics">
            <div class="well">
                <div>[<a href="javascript:void(0);" class="add">+</a>]商品图片：<input type="file" name="goods_pics[]"
                                                                                  class="input-xlarge"></div>
            </div>
        </div>
        <button class="btn btn-primary" type="submit">保存</button>
    </div>
</form>
<script type="text/javascript">
    $(function () {

        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        var ue = UE.getEditor('editor');

        $('.add').click(function () {
            var add_div = '<div>[<a href="javascript:void(0);" class="sub">-</a>]商品图片：<input type="file" name="goods_pics[]" value="" class="input-xlarge"></div>';
            $(this).parent().after(add_div);
        });
        $('.sub').live('click', function () {
            $(this).parent().remove();
        });
    });
</script>